package gui;

import data.ApplicationProperties;
import data.UserPreferences;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;
import data.AvailableComponents;
import java.awt.Dialog.ModalityType;
import java.awt.Window;
import javax.swing.JDialog;
import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import kit.Component;
import kit.OptionalSettings;
import java.awt.Color;
import kit.CustomComponent;
import kit.RequiredSettings;

/**
 * Class: ModifyComponentWindow.java
 * Description: This class allows users to add or edit components given
 * that they have all the RequiredSettings and any OptionalSettings are
 * fully implemented (see the updateAddButton() method for more info).
 * @author et
 */
public class ModifyComponentWindow extends JPanel implements RequiredSettings, OptionalSettings
{
   
    // The current component we are modifying.
    private Component curComponent;

    
    /**
     * Constructor for when a new component is to be created.
     */
    public ModifyComponentWindow()
    {
        this (new CustomComponent(), false);
    }

    /**
     * Main constructor for ModifyComponentWindow.
     * @param c - the component to edit.
     * @param editing - true if we're editing an object, false if we're adding a component.
     */
    public ModifyComponentWindow(Component c, boolean editing)
    {
        curComponent = new Component(c);
      
        initComponents();


        // Add listeners to all of the text fields.
        nameText.getDocument().addDocumentListener(new TextFieldListener());
        shortNameText.getDocument().addDocumentListener(new TextFieldListener());
        assignmentText.getDocument().addDocumentListener(new TextFieldListener());
        softStrikeText.getDocument().addDocumentListener(new TextFieldListener());
        regStrikeText.getDocument().addDocumentListener(new TextFieldListener());
        hardStrikeText.getDocument().addDocumentListener(new TextFieldListener());
        flamText.getDocument().addDocumentListener(new TextFieldListener());
        chokeText.getDocument().addDocumentListener(new TextFieldListener());


        // Setup all the available components available.
        // If we're editing a component, then don't give the user anything.
        setupAvailableComponentComboBox(editing);
        

        if (editing)
        {
            addButton.setText("Edit");
        }
    }

    /**
     * Gets the main component of this class.
     * @return the JPanel, this.
     */
    public JPanel getMainComponent()
    {
        return this;
    }

    /**
     * Setups the combo box for the available components.
     * If we're editing, give the user nothing.
     * @param editing - True if we're editing, false otherwise.
     */
    private void setupAvailableComponentComboBox(boolean editing)
    {
        DefaultComboBoxModel availableComponents;
        if (!editing)
        {
            availableComponents = new DefaultComboBoxModel(AvailableComponents.components.toArray());

            availableComponentsComboBox.setModel((ComboBoxModel) availableComponents);
            availableComponentsComboBox.setSelectedIndex(0);

            // Called as if the user changed their selection.
            componentSelected();
        }
        else
        {
            Component [] components = {curComponent};
            availableComponents = new DefaultComboBoxModel(components);
            availableComponentsComboBox.setModel((ComboBoxModel) availableComponents);
            availableComponentsComboBox.setSelectedIndex(0);
            availableComponentsComboBox.setEditable(false);
        }
    }


    /**
     * Checks to see if the add button can be enabled.
     * This does a bunch of checks to see if all the required settings
     * are completed and that any optional settings enabled are fully complete.
     */
    private void updateAddButton()
    {
        // First four are required, everything after that is optional.
        // If any of these are true, then the whole thing fails
        // and the add button is disabled.
        if (nameText.getText().trim().equals(ApplicationProperties.EMPTY_STRING) ||
            shortNameText.getText().trim().equals(ApplicationProperties.EMPTY_STRING) ||
            assignmentText.getText().trim().equals(ApplicationProperties.EMPTY_STRING_VALUE) ||
            regStrikeText.getText().trim().equals(ApplicationProperties.EMPTY_STRING) ||

            (softStrikeCheckBox.isSelected() && softStrikeValue.getText().trim().equals(ApplicationProperties.EMPTY_STRING_VALUE)) ||
            (softStrikeCheckBox.isSelected() && softStrikeText.getText().trim().equals(ApplicationProperties.EMPTY_STRING)) ||
            (hardStrikeCheckBox.isSelected() && hardStrikeValue.getText().trim().equals(ApplicationProperties.EMPTY_STRING_VALUE)) ||
            (hardStrikeCheckBox.isSelected() && hardStrikeText.getText().trim().equals(ApplicationProperties.EMPTY_STRING_VALUE)) ||
            (flamDetectionCheckBox.isSelected() && flamValue.getText().trim().equals(ApplicationProperties.EMPTY_STRING_VALUE)) ||
            (flamDetectionCheckBox.isSelected() && flamText.getText().trim().equals(ApplicationProperties.EMPTY_STRING_VALUE)) ||
            (chokeDetectionCheckBox.isSelected() && chokeValue.getText().trim().equals(ApplicationProperties.EMPTY_STRING_VALUE)) ||
            (chokeDetectionCheckBox.isSelected() && chokeText.getText().trim().equals(ApplicationProperties.EMPTY_STRING_VALUE)))
        {
            addButton.setEnabled(false);
        }
        else
        {
            addButton.setEnabled(true);
        }
    }

    /**
     * Updates the fields of curComponent with all the fresh
     * stuff, and adds it to the list of components.
     * Then is closes the window.
     */
    private void addComponent()
    {
        curComponent.setName(nameText.getText().trim());
        curComponent.setShortName(shortNameText.getText().trim());
        curComponent.setAssignment(Integer.parseInt(assignmentText.getText().trim()));
        curComponent.setRegHit(regStrikeText.getText().charAt(0));

        curComponent.setLowVelocityDetection(softStrikeCheckBox.isSelected());
        curComponent.setLowHit(softStrikeText.getText().charAt(0));
        curComponent.setLowVelocity(Integer.parseInt(softStrikeValue.getText().trim()));

        curComponent.setHighVelocityDetection(hardStrikeCheckBox.isSelected());
        curComponent.setHighHit(hardStrikeText.getText().charAt(0));
        curComponent.setHighVelocity(Integer.parseInt(hardStrikeValue.getText().trim().trim()));
        
        curComponent.setFlamDetection(flamDetectionCheckBox.isSelected());
        curComponent.setFlamHit(flamText.getText().charAt(0));
        curComponent.setFlamTime(Integer.parseInt(flamValue.getText().trim().trim()));

        curComponent.setChokeDetection(chokeDetectionCheckBox.isSelected());
        curComponent.setChokeHit(chokeText.getText().charAt(0));
        curComponent.setChokeTime(Integer.parseInt(chokeValue.getText().trim().trim()));

        UserPreferences.getInstance().addComponent(curComponent);

        closeWindow();
    }

    /**
     * The user selected something from the available components combo box.
     * This updates all the fields with the settings from the component selected.
     */
    private void componentSelected()
    {
        curComponent = new Component((Component) availableComponentsComboBox.getSelectedItem());
        nameText.setText(curComponent.getName());
        shortNameText.setText(curComponent.getShortName());
        assignmentText.setText(String.valueOf(curComponent.getAssignment()));

        softStrikeCheckBox.setSelected(curComponent.hasLowVelocityDetection());
        softStrikeText.setText(String.valueOf(curComponent.getLowHit()));
        softStrikeValue.setText(String.valueOf(curComponent.getLowVelocity()));

        regStrikeText.setText(String.valueOf(curComponent.getRegHit()));

        hardStrikeCheckBox.setSelected(curComponent.hasHighVelocityDetection());
        hardStrikeText.setText(String.valueOf(curComponent.getHighHit()));
        hardStrikeValue.setText(String.valueOf(curComponent.getHighVelocity()));

        flamDetectionCheckBox.setSelected(curComponent.hasFlamDetection());
        flamText.setText(String.valueOf(curComponent.getFlamHit()));
        flamValue.setText(String.valueOf(curComponent.getFlamTime()));

        chokeDetectionCheckBox.setSelected(curComponent.hasChokeDetection());
        chokeText.setText(String.valueOf(curComponent.getChokeHit()));
        chokeValue.setText(String.valueOf(curComponent.getChokeTime()));

        updateAddButton();
    }

    /**
     * User presses the soft strike checkbox.
     */
    private void softStrikeSelected()
    {


        softStrikeCheckBox.setSelected(softStrikeCheckBox.isSelected());

        // In order to have flams, soft strike must be enabled.
        if (softStrikeCheckBox.isSelected())
        {
            flamDetectionCheckBox.setEnabled(true);
            
            softStrikeText.setEditable(true);

            
        }
        // So disable flams if soft strike is disabled.
        else
        {
            flamDetectionCheckBox.setEnabled(false);
            flamDetectionCheckBox.setSelected(false);
            flamText.setEditable(false);

            softStrikeText.setEditable(false);
        }

        updateSoftStrikeRequirement();
        updateFlamRequirement();
    }

    /**
     * User presses the hard strike checkbox.
     */
    private void hardStrikeSelected()
    {
        hardStrikeCheckBox.setSelected(hardStrikeCheckBox.isSelected());
        
        if (hardStrikeCheckBox.isSelected())
        {
            hardStrikeText.setEditable(true);
        }
        else
        {
            hardStrikeText.setEditable(false);
        }

        updateHardStrikeRequirement();
    }

    /**
     * Users press the flam detection checkbox.
     */
    private void flamSelected()
    {
        flamDetectionCheckBox.setSelected(flamDetectionCheckBox.isSelected());

        if (flamDetectionCheckBox.isSelected())
        {
            flamText.setEditable(true);
        }
        else
        {
            flamText.setEditable(false);
        }

        updateFlamRequirement();
    }

    /**
     * Users press the flam detection checkbox.
     */
    private void chokeSelected()
    {
        chokeDetectionCheckBox.setSelected(chokeDetectionCheckBox.isSelected());

        if (chokeDetectionCheckBox.isSelected())
        {
            chokeText.setEditable(true);
        }
        else
        {
            chokeText.setEditable(false);
        }

        updateChokeRequirement();
    }
    
    /**
     * Closes the window.
     */
    private void closeWindow()
    {
        Window window = SwingUtilities.getWindowAncestor(this);
        window.dispose();
    }

    /**
     * This shows the test window to do further configuration.
     */
    private void showTestWindow()
    {

        TestWindow tw = new TestWindow(softStrikeCheckBox.isSelected(), hardStrikeCheckBox.isSelected(),
                                       flamDetectionCheckBox.isSelected(), chokeDetectionCheckBox.isSelected());

        tw.constructTest();

        Window windowAncestor = SwingUtilities.getWindowAncestor(this);
        JDialog dialog = new JDialog(windowAncestor, ApplicationProperties.MANUALLY_CONFIGURE_COMPONENT, ModalityType.APPLICATION_MODAL);

        

        // add my infoDialog's JPanel into the dialog's contentPane
        dialog.getContentPane().add(tw.getMainComponent());
        dialog.pack();
        dialog.setLocationRelativeTo(null);
        dialog.setVisible(true);

        // Test passed
        if (tw.getTestFinished())
        {
            assignmentText.setText(String.valueOf(tw.getAssigment()));
            softStrikeValue.setText(String.valueOf(tw.getSoftVelocity()));
            hardStrikeValue.setText(String.valueOf(tw.getHardVelocity()));
            flamValue.setText(String.valueOf(tw.getFlamTime()));
            chokeValue.setText(String.valueOf(tw.getChokeTime()));
            updateAddButton();
        }
        // If this is the case, then don't take any values
        // since they must have pressed cancel.
        else
        {
            // .....
        }
    }

    /**
     * Check to see that the name requirement is fulfilled.
     */
    private void updateNameRequirement()
    {
        if (nameText.getText().equals(ApplicationProperties.EMPTY_STRING))
        {
            nameRequiredLabel.setForeground(Color.RED);
        }
        else
        {
            nameRequiredLabel.setForeground(Color.GREEN);
        }
    }

    /**
     * Check to see that the short name requirement is fulfilled.
     */
    private void updateShortNameRequirement()
    {
        if (shortNameText.getText().equals(ApplicationProperties.EMPTY_STRING))
        {
            shortNameRequiredLabel.setForeground(Color.RED);
        }
        else
        {
            shortNameRequiredLabel.setForeground(Color.GREEN);
        }
    }

    /**
     * Check to see that the assignment requirement is fulfilled.
     */
    private void updateAssignmentRequirement()
    {
        if (assignmentText.getText().trim().equals(ApplicationProperties.EMPTY_STRING_VALUE))
        {
            assignmentRequiredLabel.setForeground(Color.RED);
        }
        else
        {
            assignmentRequiredLabel.setForeground(Color.GREEN);
        }
    }

    /**
     * Check to see that the soft strike requirement is fulfilled.
     */
    private void updateSoftStrikeRequirement()
    {
        if (softStrikeCheckBox.isSelected() && softStrikeText.getText().trim().equals(ApplicationProperties.EMPTY_STRING) ||
                (softStrikeCheckBox.isSelected() && softStrikeValue.getText().trim().equals(ApplicationProperties.EMPTY_STRING_VALUE)))
        {
            softStrikeRequiredLabel.setForeground(Color.RED);
        }
        else
        {
            softStrikeRequiredLabel.setForeground(Color.GREEN);
        }

    }

    /**
     * Check to see that the regular strike requirement is fulfilled.
     */
    private void updateRegStrikeRequirement()
    {
        if (strikeCheckBox.isSelected() && regStrikeText.getText().trim().equals(ApplicationProperties.EMPTY_STRING))
        {
            strikeRequiredLabel.setForeground(Color.RED);
        }
        else
        {
            strikeRequiredLabel.setForeground(Color.GREEN);
        }
    }

    /**
     * Check to see that the hard strike requirement is fulfilled.
     */
    private void updateHardStrikeRequirement()
    {
        if (hardStrikeCheckBox.isSelected() && hardStrikeText.getText().trim().equals(ApplicationProperties.EMPTY_STRING) ||
                (hardStrikeCheckBox.isSelected() && hardStrikeValue.getText().trim().equals(ApplicationProperties.EMPTY_STRING_VALUE)))
        {
            hardStrikeRequiredLabel.setForeground(Color.RED);
        }
        else
        {
            hardStrikeRequiredLabel.setForeground(Color.GREEN);
        }
    }

    /**
     * Check to see that the flam requirement is fulfilled.
     */
    private void updateFlamRequirement()
    {
        if (flamDetectionCheckBox.isSelected() && flamText.getText().trim().equals(ApplicationProperties.EMPTY_STRING) ||
                 (flamDetectionCheckBox.isSelected() && flamValue.getText().trim().equals(ApplicationProperties.EMPTY_STRING_VALUE)))
        {
            flamRequiredLabel.setForeground(Color.RED);
        }
        else
        {
            flamRequiredLabel.setForeground(Color.GREEN);
        }
    }

    /**
     * Check to see that the choke requirement is fulfilled.
     */
    private void updateChokeRequirement()
    {
        if (chokeDetectionCheckBox.isSelected() && chokeText.getText().trim().equals(ApplicationProperties.EMPTY_STRING) ||
                (chokeDetectionCheckBox.isSelected() && chokeValue.getText().trim().equals(ApplicationProperties.EMPTY_STRING_VALUE)))
        {
            chokeRequiredLabel.setForeground(Color.RED);
        }
        else
        {
            chokeRequiredLabel.setForeground(Color.GREEN);
        }
    }




    /**
     * Sub-Class: TextFieldListener
     * Description: This sub class of ModifyComponentWindow.java simply
     * listens for any change from any of the text boxes. If it hears
     * one, it checks all the requirement labels to see if they should
     * change from red to green or vice-versa.
     * Then it calls updateAddButton() to see if we can now
     * legitamitely can add the component now.
     * @author: et
     */
    class TextFieldListener implements DocumentListener
    {
        /**
         * Something was added to a text field.
         * @param e - document event
         */
        public void insertUpdate(DocumentEvent e)
        {
            updateNameRequirement();
            updateShortNameRequirement();
            updateAssignmentRequirement();
            updateSoftStrikeRequirement();
            updateRegStrikeRequirement();
            updateHardStrikeRequirement();
            updateFlamRequirement();
            updateChokeRequirement();
            
            updateAddButton();
        }

        /**
         * Something was removed from a text field.
         * @param e - document event.
         */
        public void removeUpdate(DocumentEvent e)
        {
            updateNameRequirement();
            updateShortNameRequirement();
            updateAssignmentRequirement();
            updateSoftStrikeRequirement();
            updateRegStrikeRequirement();
            updateHardStrikeRequirement();
            updateFlamRequirement();
            updateChokeRequirement();
            updateAddButton();

            updateAddButton();
        }

        /**
         * Something was changed in a text field.
         * @param e - document event.
         */
        public void changedUpdate(DocumentEvent e)
        {
            updateNameRequirement();
            updateShortNameRequirement();
            updateAssignmentRequirement();
            updateSoftStrikeRequirement();
            updateRegStrikeRequirement();
            updateHardStrikeRequirement();
            updateFlamRequirement();
            updateChokeRequirement();

            updateAddButton();
        }
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        componentPanel = new javax.swing.JPanel();
        availableComponentsComboBox = new javax.swing.JComboBox();
        settingsPanel = new javax.swing.JPanel();
        configureButton = new javax.swing.JButton();
        namingPanel = new javax.swing.JPanel();
        nameLabel = new javax.swing.JLabel();
        shortNameLabel = new javax.swing.JLabel();
        nameRequiredLabel = new javax.swing.JLabel();
        shortNameRequiredLabel = new javax.swing.JLabel();
        nameText = new javax.swing.JFormattedTextField();
        shortNameText = new javax.swing.JFormattedTextField();
        assignmentLabel = new javax.swing.JLabel();
        assignmentText = new javax.swing.JTextField();
        assignmentRequiredLabel = new javax.swing.JLabel();
        velocityPanel = new javax.swing.JPanel();
        strikeCheckBox = new javax.swing.JCheckBox();
        softStrikeCheckBox = new javax.swing.JCheckBox();
        hardStrikeCheckBox = new javax.swing.JCheckBox();
        strikeRequiredLabel = new javax.swing.JLabel();
        softStrikeRequiredLabel = new javax.swing.JLabel();
        hardStrikeRequiredLabel = new javax.swing.JLabel();
        softStrikeText = new javax.swing.JFormattedTextField();
        regStrikeText = new javax.swing.JFormattedTextField();
        hardStrikeText = new javax.swing.JFormattedTextField();
        velNoteLabel = new javax.swing.JLabel();
        velValueLabel = new javax.swing.JLabel();
        softStrikeValue = new javax.swing.JFormattedTextField();
        hardStrikeValue = new javax.swing.JFormattedTextField();
        advancedPanel = new javax.swing.JPanel();
        flamDetectionCheckBox = new javax.swing.JCheckBox();
        chokeDetectionCheckBox = new javax.swing.JCheckBox();
        flamRequiredLabel = new javax.swing.JLabel();
        chokeRequiredLabel = new javax.swing.JLabel();
        flamText = new javax.swing.JFormattedTextField();
        chokeText = new javax.swing.JFormattedTextField();
        advNoteValue = new javax.swing.JLabel();
        advValueLabel = new javax.swing.JLabel();
        flamValue = new javax.swing.JFormattedTextField();
        chokeValue = new javax.swing.JFormattedTextField();
        requiredLabelSymbol = new javax.swing.JLabel();
        requiredLabel = new javax.swing.JLabel();
        completedLabelSymbol = new javax.swing.JLabel();
        completedLabel = new javax.swing.JLabel();
        addButton = new javax.swing.JButton();
        cancelButton = new javax.swing.JButton();

        componentPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Component"));

        availableComponentsComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                availableComponentsComboBoxActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout componentPanelLayout = new javax.swing.GroupLayout(componentPanel);
        componentPanel.setLayout(componentPanelLayout);
        componentPanelLayout.setHorizontalGroup(
            componentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(componentPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(availableComponentsComboBox, 0, 329, Short.MAX_VALUE)
                .addContainerGap())
        );
        componentPanelLayout.setVerticalGroup(
            componentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(componentPanelLayout.createSequentialGroup()
                .addComponent(availableComponentsComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(52, Short.MAX_VALUE))
        );

        settingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Settings"));

        configureButton.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 12));
        configureButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/test.png"))); // NOI18N
        configureButton.setText("Customize Component");
        configureButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                configureButtonActionPerformed(evt);
            }
        });

        namingPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Name Settings"));

        nameLabel.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 12));
        nameLabel.setText("Name");

        shortNameLabel.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 12));
        shortNameLabel.setText("Short Name");

        nameRequiredLabel.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 14));
        nameRequiredLabel.setForeground(java.awt.Color.RED);
        nameRequiredLabel.setText("*");

        shortNameRequiredLabel.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 14));
        shortNameRequiredLabel.setForeground(java.awt.Color.RED);
        shortNameRequiredLabel.setText("*");

        assignmentLabel.setText("Assignment");

        assignmentText.setEditable(false);

        assignmentRequiredLabel.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 14));
        assignmentRequiredLabel.setForeground(java.awt.Color.RED);
        assignmentRequiredLabel.setText("*");

        javax.swing.GroupLayout namingPanelLayout = new javax.swing.GroupLayout(namingPanel);
        namingPanel.setLayout(namingPanelLayout);
        namingPanelLayout.setHorizontalGroup(
            namingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(namingPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(namingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(namingPanelLayout.createSequentialGroup()
                        .addGroup(namingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(shortNameLabel)
                            .addComponent(nameLabel))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(namingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(shortNameText, javax.swing.GroupLayout.DEFAULT_SIZE, 163, Short.MAX_VALUE)
                            .addComponent(nameText, javax.swing.GroupLayout.DEFAULT_SIZE, 163, Short.MAX_VALUE)))
                    .addGroup(namingPanelLayout.createSequentialGroup()
                        .addComponent(assignmentLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(assignmentText, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(namingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(assignmentRequiredLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(shortNameRequiredLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(nameRequiredLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        namingPanelLayout.setVerticalGroup(
            namingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(namingPanelLayout.createSequentialGroup()
                .addGroup(namingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nameRequiredLabel)
                    .addComponent(nameText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(nameLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(namingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(shortNameLabel)
                    .addComponent(shortNameText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(shortNameRequiredLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
                .addGroup(namingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(assignmentLabel)
                    .addComponent(assignmentText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(assignmentRequiredLabel))
                .addContainerGap())
        );

        velocityPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Velocity Settings"));

        strikeCheckBox.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 12));
        strikeCheckBox.setSelected(true);
        strikeCheckBox.setText("Strike Detection");
        strikeCheckBox.setEnabled(false);

        softStrikeCheckBox.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 12));
        softStrikeCheckBox.setText("Soft Strike Detection");
        softStrikeCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                softStrikeCheckBoxActionPerformed(evt);
            }
        });

        hardStrikeCheckBox.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 12));
        hardStrikeCheckBox.setText("Hard Strike Detection");
        hardStrikeCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                hardStrikeCheckBoxActionPerformed(evt);
            }
        });

        strikeRequiredLabel.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 14));
        strikeRequiredLabel.setForeground(java.awt.Color.RED);
        strikeRequiredLabel.setText("*");

        softStrikeRequiredLabel.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 14));
        softStrikeRequiredLabel.setForeground(java.awt.Color.GREEN);
        softStrikeRequiredLabel.setText("*");

        hardStrikeRequiredLabel.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 14));
        hardStrikeRequiredLabel.setForeground(java.awt.Color.GREEN);
        hardStrikeRequiredLabel.setText("*");

        softStrikeText.setEditable(false);
        try {
            softStrikeText.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("*")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        try {
            regStrikeText.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("*")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        hardStrikeText.setEditable(false);
        try {
            hardStrikeText.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("*")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        velNoteLabel.setText("Note");

        velValueLabel.setText("Value");

        softStrikeValue.setEditable(false);
        try {
            softStrikeValue.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("****")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        hardStrikeValue.setEditable(false);
        try {
            hardStrikeValue.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("****")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        javax.swing.GroupLayout velocityPanelLayout = new javax.swing.GroupLayout(velocityPanel);
        velocityPanel.setLayout(velocityPanelLayout);
        velocityPanelLayout.setHorizontalGroup(
            velocityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(velocityPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(velocityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(softStrikeCheckBox)
                    .addComponent(strikeCheckBox)
                    .addComponent(hardStrikeCheckBox))
                .addGap(9, 9, 9)
                .addGroup(velocityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(velNoteLabel, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(velocityPanelLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(velocityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(regStrikeText, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE)
                            .addComponent(softStrikeText, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE)
                            .addComponent(hardStrikeText, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(velocityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(hardStrikeValue)
                    .addComponent(softStrikeValue)
                    .addComponent(velValueLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(velocityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(strikeRequiredLabel)
                    .addComponent(softStrikeRequiredLabel)
                    .addComponent(hardStrikeRequiredLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        velocityPanelLayout.setVerticalGroup(
            velocityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(velocityPanelLayout.createSequentialGroup()
                .addGroup(velocityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(velocityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(velNoteLabel)
                        .addComponent(velValueLabel))
                    .addGroup(velocityPanelLayout.createSequentialGroup()
                        .addGap(16, 16, 16)
                        .addGroup(velocityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(softStrikeText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(softStrikeValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(softStrikeCheckBox)
                            .addComponent(softStrikeRequiredLabel))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(velocityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(strikeCheckBox)
                            .addComponent(regStrikeText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(strikeRequiredLabel))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(velocityPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(hardStrikeCheckBox)
                            .addComponent(hardStrikeText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(hardStrikeValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(hardStrikeRequiredLabel))))
                .addContainerGap(35, Short.MAX_VALUE))
        );

        advancedPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Advanced Settings"));

        flamDetectionCheckBox.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 12));
        flamDetectionCheckBox.setText("Flam Detection");
        flamDetectionCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                flamDetectionCheckBoxActionPerformed(evt);
            }
        });

        chokeDetectionCheckBox.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 12));
        chokeDetectionCheckBox.setText("Choke Detection");
        chokeDetectionCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chokeDetectionCheckBoxActionPerformed(evt);
            }
        });

        flamRequiredLabel.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 14));
        flamRequiredLabel.setForeground(java.awt.Color.GREEN);
        flamRequiredLabel.setText("*");

        chokeRequiredLabel.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 14));
        chokeRequiredLabel.setForeground(java.awt.Color.GREEN);
        chokeRequiredLabel.setText("*");

        flamText.setEditable(false);
        try {
            flamText.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("*")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        chokeText.setEditable(false);
        try {
            chokeText.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("*")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        advNoteValue.setText("Note");

        advValueLabel.setText("Time (ms)");

        flamValue.setEditable(false);
        try {
            flamValue.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("****")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        chokeValue.setEditable(false);
        try {
            chokeValue.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("****")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        javax.swing.GroupLayout advancedPanelLayout = new javax.swing.GroupLayout(advancedPanel);
        advancedPanel.setLayout(advancedPanelLayout);
        advancedPanelLayout.setHorizontalGroup(
            advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(advancedPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(flamDetectionCheckBox)
                    .addComponent(chokeDetectionCheckBox))
                .addGap(18, 18, 18)
                .addGroup(advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(advancedPanelLayout.createSequentialGroup()
                        .addComponent(advNoteValue)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(advValueLabel)
                        .addContainerGap())
                    .addGroup(advancedPanelLayout.createSequentialGroup()
                        .addGroup(advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(flamText, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE)
                            .addComponent(chokeText, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(chokeValue)
                            .addComponent(flamValue, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(chokeRequiredLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(flamRequiredLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 22, Short.MAX_VALUE))
                        .addGap(52, 52, 52))))
        );
        advancedPanelLayout.setVerticalGroup(
            advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(advancedPanelLayout.createSequentialGroup()
                .addGroup(advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(advNoteValue)
                    .addComponent(advValueLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(flamDetectionCheckBox)
                    .addComponent(flamText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(flamRequiredLabel)
                    .addComponent(flamValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(advancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(chokeDetectionCheckBox)
                    .addComponent(chokeText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(chokeRequiredLabel)
                    .addComponent(chokeValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        requiredLabelSymbol.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 14));
        requiredLabelSymbol.setForeground(java.awt.Color.RED);
        requiredLabelSymbol.setText("*");

        requiredLabel.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 12));
        requiredLabel.setText("Required");

        completedLabelSymbol.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 14));
        completedLabelSymbol.setForeground(java.awt.Color.GREEN);
        completedLabelSymbol.setText("*");

        completedLabel.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 12));
        completedLabel.setText("Completed");

        javax.swing.GroupLayout settingsPanelLayout = new javax.swing.GroupLayout(settingsPanel);
        settingsPanel.setLayout(settingsPanelLayout);
        settingsPanelLayout.setHorizontalGroup(
            settingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(settingsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(settingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(settingsPanelLayout.createSequentialGroup()
                        .addComponent(requiredLabelSymbol, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(6, 6, 6)
                        .addComponent(requiredLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 118, Short.MAX_VALUE)
                        .addComponent(completedLabelSymbol, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(completedLabel)
                        .addGap(29, 29, 29))
                    .addGroup(settingsPanelLayout.createSequentialGroup()
                        .addGap(40, 40, 40)
                        .addComponent(configureButton))
                    .addGroup(settingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(advancedPanel, javax.swing.GroupLayout.Alignment.LEADING, 0, 311, Short.MAX_VALUE)
                        .addComponent(namingPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(velocityPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        settingsPanelLayout.setVerticalGroup(
            settingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(settingsPanelLayout.createSequentialGroup()
                .addComponent(namingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(velocityPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(advancedPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(configureButton)
                .addGap(30, 30, 30)
                .addGroup(settingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(requiredLabel)
                    .addComponent(requiredLabelSymbol)
                    .addComponent(completedLabel)
                    .addComponent(completedLabelSymbol))
                .addContainerGap())
        );

        addButton.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 12));
        addButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/add.png"))); // NOI18N
        addButton.setText("Add Component");
        addButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addButtonActionPerformed(evt);
            }
        });

        cancelButton.setFont(new java.awt.Font("Bitstream Vera Sans", 1, 12));
        cancelButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/cancel.png"))); // NOI18N
        cancelButton.setText("Cancel");
        cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(componentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(addButton)
                .addGap(40, 40, 40)
                .addComponent(cancelButton)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addComponent(settingsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(componentPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(settingsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(addButton)
                    .addComponent(cancelButton))
                .addGap(24, 24, 24))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
        addComponent();
    }//GEN-LAST:event_addButtonActionPerformed

    private void availableComponentsComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_availableComponentsComboBoxActionPerformed
        componentSelected();
    }//GEN-LAST:event_availableComponentsComboBoxActionPerformed

    private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
        closeWindow();
    }//GEN-LAST:event_cancelButtonActionPerformed

    private void configureButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_configureButtonActionPerformed
    {//GEN-HEADEREND:event_configureButtonActionPerformed
        showTestWindow();
}//GEN-LAST:event_configureButtonActionPerformed

    private void chokeDetectionCheckBoxActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_chokeDetectionCheckBoxActionPerformed
    {//GEN-HEADEREND:event_chokeDetectionCheckBoxActionPerformed
        chokeSelected();
    }//GEN-LAST:event_chokeDetectionCheckBoxActionPerformed

    private void softStrikeCheckBoxActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_softStrikeCheckBoxActionPerformed
    {//GEN-HEADEREND:event_softStrikeCheckBoxActionPerformed
        softStrikeSelected();
    }//GEN-LAST:event_softStrikeCheckBoxActionPerformed

    private void hardStrikeCheckBoxActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_hardStrikeCheckBoxActionPerformed
    {//GEN-HEADEREND:event_hardStrikeCheckBoxActionPerformed
        hardStrikeSelected();
    }//GEN-LAST:event_hardStrikeCheckBoxActionPerformed

    private void flamDetectionCheckBoxActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_flamDetectionCheckBoxActionPerformed
    {//GEN-HEADEREND:event_flamDetectionCheckBoxActionPerformed
        flamSelected();
    }//GEN-LAST:event_flamDetectionCheckBoxActionPerformed




    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton addButton;
    private javax.swing.JLabel advNoteValue;
    private javax.swing.JLabel advValueLabel;
    private javax.swing.JPanel advancedPanel;
    private javax.swing.JLabel assignmentLabel;
    private javax.swing.JLabel assignmentRequiredLabel;
    private javax.swing.JTextField assignmentText;
    private javax.swing.JComboBox availableComponentsComboBox;
    private javax.swing.JButton cancelButton;
    private javax.swing.JCheckBox chokeDetectionCheckBox;
    private javax.swing.JLabel chokeRequiredLabel;
    private javax.swing.JFormattedTextField chokeText;
    private javax.swing.JFormattedTextField chokeValue;
    private javax.swing.JLabel completedLabel;
    private javax.swing.JLabel completedLabelSymbol;
    private javax.swing.JPanel componentPanel;
    private javax.swing.JButton configureButton;
    private javax.swing.JCheckBox flamDetectionCheckBox;
    private javax.swing.JLabel flamRequiredLabel;
    private javax.swing.JFormattedTextField flamText;
    private javax.swing.JFormattedTextField flamValue;
    private javax.swing.JCheckBox hardStrikeCheckBox;
    private javax.swing.JLabel hardStrikeRequiredLabel;
    private javax.swing.JFormattedTextField hardStrikeText;
    private javax.swing.JFormattedTextField hardStrikeValue;
    private javax.swing.JLabel nameLabel;
    private javax.swing.JLabel nameRequiredLabel;
    private javax.swing.JFormattedTextField nameText;
    private javax.swing.JPanel namingPanel;
    private javax.swing.JFormattedTextField regStrikeText;
    private javax.swing.JLabel requiredLabel;
    private javax.swing.JLabel requiredLabelSymbol;
    private javax.swing.JPanel settingsPanel;
    private javax.swing.JLabel shortNameLabel;
    private javax.swing.JLabel shortNameRequiredLabel;
    private javax.swing.JFormattedTextField shortNameText;
    private javax.swing.JCheckBox softStrikeCheckBox;
    private javax.swing.JLabel softStrikeRequiredLabel;
    private javax.swing.JFormattedTextField softStrikeText;
    private javax.swing.JFormattedTextField softStrikeValue;
    private javax.swing.JCheckBox strikeCheckBox;
    private javax.swing.JLabel strikeRequiredLabel;
    private javax.swing.JLabel velNoteLabel;
    private javax.swing.JLabel velValueLabel;
    private javax.swing.JPanel velocityPanel;
    // End of variables declaration//GEN-END:variables



    // The following are the required methods from the OptionalSettings interface
    // There's really no reason to have them since they were designed to be used
    // for the kit package.
    // However, the interface remains so that whenever any new optional
    // settings are added, this window is required to be adjusted accordingly.
    public void setLowVelocityDetection(boolean lowVelocityDetection)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setHighVelocityDetection(boolean highVelocityDetection)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setLowVelocity(int lowVelocity)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setHighVelocity(int highVelocity)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setLowHit(char lowHit)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setHighHit(char hardHit)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setFlamDetection(boolean flamDetection)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setChokeDetection(boolean chokeDetection)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setFlamTime(long flamTime)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }
 
    public void setChokeTime(long chokeTime)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setFlamHit(char flamHit)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setChokeHit(char chokeHit)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }


    public void setAssignment(int assignment)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setShortName(String shortName)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setRegHit(char regHit)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
